**************************PANEL-EMBEDDED EXPERIMENT********************************'

use "INSERTPATH\panel_experiment.dta", clear
cd "INSERTPATH\results"



***FIGURE 4: UPPER PANEL (please note that the full figure is replicated by combining "experiment_w3" below with the lower panel conducted in the replication experiment file). If desired, one can check the robustness of the findings with the party ID variable, pid_w3, instead of the vote choice variable, voted_w3. The effects are similar, or even slightly stronger, with the pid_w3 variable. "undemocratic_exp_w3" is the undemocratic attitudes index, while the "violate_court1_" and "violate_law1_w3" are the individual undemoratic attitude outcome items. "treatment" is the four condition treatment variable.
reg undemocratic_exp_w3  i.treatment if voted_w3 < 4
margins, over(treatment) post
est store index

reg violate_court1_w3  i.treatment if voted_w3 < 4
margins, over(treatment) post
est store court

reg violate_law1_w3  i.treatment if voted_w3 < 4
margins, over(treatment) post
est store law

coefplot law, bylabel(Violate law to reform state media) xlabel(1 2 3 4 5 6 7, labsize(med)) || court, bylabel(Pack Constitutional Court PiS-style) || index, bylabel(Index) byopts(row(3) compact note("Marginal means", pos(1))) coeflabels(, labsize(med))
graph save mms.gph, replace

reg undemocratic_exp_w3  i.treatment if voted_w3 < 4
margins, dydx(treatment) post
est store index

reg violate_court1_w3  i.treatment if voted_w3 < 4
margins, dydx(treatment) post
est store court

reg violate_law1_w3  i.treatment if voted_w3 < 4
margins, dydx(treatment) post
est store law

coefplot law, bylabel(Violate law to reform state media) xlabel(-1 -.5 0 .5 1 1.5, labsize(med))  xline(0) omitted baselevels || court, bylabel(Pack Constitutional Court PiS-style) omitted baselevels || index, bylabel(Index) omitted baselevels byopts(row(3) compact note("Effects", pos(1))) coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " " 3.treatment = " ",labsize(med)) fxsize(32.3) 
graph save effects.gph, replace

graph combine mms.gph effects.gph, row(1) title("{bf:Panel-Embedded Experiment}") fysize(64)
graph save experiment_w3, replace




****FIGURE 5. "protest1_w3" is the outcome variable capturing willingness to engage in anti-government protest.
reg protest1_w3  i.treatment if voted_w3 == 4
margins, over(treatment) post
est store protest
 
coefplot protest, ///
    bylabel("Anti-government protest") ///
    xlabel(1 2 3 4 5 6 7, labsize(large)) ///
    byopts(row(3) compact note("Marginal means", pos(1))) ///
	coeflabels(,labsize(large)) ///
    title("Marginal means", pos(1) size(large)) ///
    plotregion(style(box) lcolor(black) lwidth(medthick)) ///
    graphregion(color(white))
graph save mms_protest.gph, replace

reg protest1_w3  i.treatment if voted_w3 == 4
margins, dydx(treatment) post
est store protest

coefplot protest, ///
    bylabel("Anti-government protest") ///
    xlabel(-1.5 -1 -.5 0 .5 1, labsize(large)) ///
    xline(0) omitted baselevels ///
    byopts(row(3) compact note("Effects", pos(1))) ///
    coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " " 3.treatment = " ") ///
    fxsize(58) ///
    title("Effects", pos(1) size(large)) ///
    plotregion(style(box) lcolor(black) lwidth(medthick)) ///
    graphregion(color(white))
graph save effects_protest.gph, replace

graph combine mms_protest.gph effects_protest.gph, row(1) title("{bf:Willingness to engage in anti-government protest}", size(large)) ysize(4) xsize(7)
graph export figure5.pdf, replace


***FOOTNOTE 9. "SMC_Tusk" is the manipulation check. "anytreat" is a version of the treatment variable collapsing all treatment conditions and compare these against the "careful + no reminder" baseline condition.
reg SMC_Tusk i.treatment 
reg SMC_Tusk i.treatment if voted_w3 < 4

reg SMC_Tusk anytreat
reg SMC_Tusk anytreat if voted_w3 < 4



***FIGURE E1. Again uses the "anytreat" variable to allow for an interflex analysis (see Appendix E). In the first model, undemocratic attitudes (as used in the panel analysis) is used as moderator; in the second, the perception of PiS' voters willingness to engage in antidemocratic practices is used.
interflex undemocratic_exp_w3 anytreat undemocratic if voted_w3 < 4, dlab(Treatment) ylab(Outcome Index) xlab(Undemocratic Attitudes) xd(density) 
graph save ambiguity, replace
interflex undemocratic_exp_w3 anytreat PiS_perception if voted_w3 < 4, dlab(Treatment) ylab(Outcome Index) xlab(Meta-perceptions of PiS Voters) xd(density)
graph save metaperceptions, replace
graph combine ambiguity.gph metaperceptions.gph, row(1) ycommon
graph export figureE1.pdf, replace



*******FIGURE F1: UPPER PANEL (please note that the full figure is replicated by combining "experiment_w3_cov" below with the lower panel conducted in the replication experiment file). The covariates are the 4 indices of support for violence, anti-establishment attitudes, election denial, and undemocratic attitudes used in the panel analysis as well as affect toward Tusk's party, PO.
reg undemocratic_exp_w3 violence undemocratic AEO denial_oct affect_PO i.treatment if voted_w3 < 4
margins, over(treatment) post
est store index_cov

reg violate_court1_w3 violence undemocratic AEO denial_oct affect_PO i.treatment if voted_w3 < 4
margins, over(treatment) post
est store court_cov

reg violate_law1_w3 violence undemocratic AEO denial_oct affect_PO i.treatment if voted_w3 < 4
margins, over(treatment) post
est store law_cov

coefplot law_cov, bylabel(Violate law to reform state media) xlabel(1 2 3 4 5 6 7) || court_cov, bylabel(Pack Constitutional Court PiS-style) || index_cov, bylabel(Index) byopts(row(3) compact note("Marginal means", pos(1)))
graph save mms_cov.gph, replace

reg undemocratic_exp_w3 violence undemocratic AEO denial_oct affect_PO i.treatment  if voted_w3 < 4
margins, dydx(treatment) post
est store index_cov

reg violate_court1_w3 violence undemocratic AEO denial_oct affect_PO i.treatment   if voted_w3 < 4
margins, dydx(treatment) post
est store court_cov

reg violate_law1_w3 violence undemocratic AEO denial_oct affect_PO i.treatment if voted_w3 < 4
margins, dydx(treatment) post
est store law_cov

coefplot law_cov, bylabel(Violate law to reform state media) xlabel(-1 -.5 0 .5 1 1.5)  xline(0) omitted baselevels || court_cov, bylabel(Pack Constitutional Court PiS-style) omitted baselevels || index_cov, bylabel(Index) omitted baselevels byopts(row(3) compact note("Effects", pos(1))) coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " " 3.treatment = " ") fxsize(34)
graph save effects_cov.gph, replace

graph combine mms_cov.gph effects_cov.gph, row(1) title("{bf:Panel-Embedded Experiment}") fysize(64)
graph save experiment_w3_cov, replace



*****FIGURE F2. Uses the same covariates for testing the hypothesis about protest, adjusting for covariates.
reg protest1_w3 violence undemocratic AEO denial_oct affect_PO i.treatment if voted_w3 == 4
margins, over(treatment) post
est store protest
 
coefplot protest, ///
    bylabel("Anti-government protest") ///
    xlabel(1 2 3 4 5 6 7, labsize(large)) ///
    byopts(row(3) compact note("Marginal means", pos(1))) ///
	coeflabels(,labsize(large)) ///
    title("Marginal means", pos(1) size(large)) ///
    plotregion(style(box) lcolor(black) lwidth(medthick)) ///
    graphregion(color(white))
graph save mms_protest.gph, replace

reg protest1_w3 violence undemocratic AEO denial_oct affect_PO  i.treatment if voted_w3 == 4
margins, dydx(treatment) post
est store protest

coefplot protest, ///
    bylabel("Anti-government protest") ///
    xlabel(-1.5 -1 -.5 0 .5 1, labsize(large)) ///
    xline(0) omitted baselevels ///
    byopts(row(3) compact note("Effects", pos(1))) ///
    coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " " 3.treatment = " ") ///
    fxsize(58) ///
    title("Effects", pos(1) size(large)) ///
    plotregion(style(box) lcolor(black) lwidth(medthick)) ///
    graphregion(color(white))
graph save effects_protest.gph, replace

graph combine mms_protest.gph effects_protest.gph, row(1) title("{bf:Willingness to engage in anti-government protest (with covariates)}", size(large)) ysize(4) xsize(7)
graph export figureF2.pdf, replace



**************************REPLICATION EXPERIMENT********************************'

use "INSERTPATH\replication_experiment.dta", clear


******FIGURE 4: Lower panel (then combine with panel experiment above to plot full Figure 4). Mimics the setup from the panel embedded experiment, simply with slightly different names for the outcome, treatment, and pro-democratic alliance voter indicator.
reg undemocratic_exp  i.treat if votedfor < 4
margins, over(treat) post
est store index

reg violate_court  i.treat if votedfor < 4
margins, over(treat) post
est store court

reg violate_law  i.treat if votedfor < 4
margins, over(treat) post
est store law

coefplot law, bylabel(Violate law to reform state media) xlabel(1 2 3 4 5 6 7, labsize(med)) || court, bylabel(Pack Constitutional Court PiS-style) || index, bylabel(Index) byopts(row(3) compact note("Marginal means", pos(1))) coeflabels(,labsize(med)) 
graph save mms_replication.gph, replace

reg undemocratic_exp  i.treat if votedfor < 4
margins, dydx(treat) post
est store index

reg violate_court  i.treat if votedfor < 4
margins, dydx(treat) post
est store court

reg violate_law  i.treat if votedfor < 4
margins, dydx(treat) post
est store law

coefplot law, bylabel(Violate law to reform state media) xlabel(-1 -.5 0 .5 1 1.5, labsize(med))  xline(0) omitted baselevels || court, bylabel(Pack Constitutional Court PiS-style) omitted baselevels || index, bylabel(Index) omitted baselevels byopts(row(3) compact note("Effects", pos(1))) coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " ",labsize(med)) fxsize(32.3) 
graph save effects_replication.gph, replace

graph combine mms_replication.gph effects_replication.gph, row(1) title("{bf:Replication Experiment}")
graph save experiment_replication, replace
graph combine experiment_w3.gph experiment_replication.gph, row(2) ysize(9.5) xsize(7.5)
graph export figure4.pdf, replace




*FIGURE 6. Engages the revenge psychology outcomes of perceiving Tusk as vengeful ("vengeful"), being satisfied with the restoration strategy, being generally happy with the political situation, and anger with PiS' time in government.
reg vengeful i.treat if votedfor < 4
margins, over(treat) post
est store vengeful

reg satisfied  i.treat if votedfor < 4
margins, over(treat) post
est store satisfaction

reg general_happy  i.treat if votedfor < 4
margins, over(treat) post
est store happy

reg pis_anger  i.treat if votedfor < 4
margins, over(treat) post
est store anger

coefplot vengeful, bylabel(Perceive Tusk as Vengeful) xlabel(1 2 3 4 5 6 7, labsize(med)) || satisfaction, bylabel(Satisfied with Restoration Strategy) || happy, bylabel(Happy with Current Political Situation) || anger, bylabel(Angry about PiS' Rule) byopts(row(4) compact note("{bf:Marginal means}", pos(1))) coeflabels(,labsize(med)) 
graph save mms_revenge.gph, replace

reg vengeful i.treat if votedfor < 4
margins, dydx(treat) post
est store vengeful

reg satisfied  i.treat if votedfor < 4
margins, dydx(treat) post
est store satisfaction

reg general_happy  i.treat if votedfor < 4
margins, dydx(treat) post
est store happy

reg pis_anger  i.treat if votedfor < 4
margins, dydx(treat) post
est store anger

coefplot vengeful, bylabel(Perceive Tusk as Vengeful) xlabel(-1 -.5 0 .5 1 1.5, labsize(med))  xline(0) omitted baselevels || satisfaction, bylabel(Satisfied with Restoration Strategy) omitted baselevels || happy, bylabel(Happy with Current Political Situation) omitted baselevels || anger, bylabel(Angry about PiS' Rule) omitted baselevels byopts(row(4) compact note("{bf:Effects}", pos(1))) coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " ",labsize(med)) fxsize(57) 
graph save effects_revenge.gph, replace

graph combine mms_revenge.gph effects_revenge.gph, row(1)
graph export figure6.pdf, replace





*****Figure F1: Lower panel (then combined with panel experiment above to plot full Figure F1). Adjusting for a composite measure of affect towards PO, NL, TD, and PiS (reversed) and democratic attitudes as covariates.
reg undemocratic_exp affect democratic i.treat if votedfor < 4
margins, over(treat) post
est store index_cov

reg violate_court affect democratic i.treat if votedfor < 4
margins, over(treat) post
est store court_cov

reg violate_law affect democratic i.treat if votedfor < 4
margins, over(treat) post
est store law_cov

coefplot law_cov, bylabel(Violate law to reform state media) xlabel(1 2 3 4 5 6 7) || court_cov, bylabel(Pack Constitutional Court PiS-style) || index_cov, bylabel(Index) byopts(row(3) compact note("Marginal means", pos(1)))
graph save mms_cov_replication.gph, replace

reg undemocratic_exp affect democratic i.treat  if votedfor < 4
margins, dydx(treat) post
est store index_cov

reg violate_court affect democratic i.treat if votedfor < 4
margins, dydx(treat) post
est store court_cov

reg violate_law affect democratic i.treat   if votedfor < 4
margins, dydx(treat) post
est store law_cov

coefplot law_cov, bylabel(Violate law to reform state media) xlabel(-1 -.5 0 .5 1 1.5)  xline(0) omitted baselevels || court_cov, bylabel(Pack Constitutional Court PiS-style) omitted baselevels || index_cov, bylabel(Index) omitted baselevels byopts(row(3) compact note("Effects", pos(1))) coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " ") fxsize(34)
graph save effects_cov_replication.gph, replace

graph combine mms_cov_replication.gph effects_cov_replication.gph, row(1) title("{bf:Replication Experiment}")
graph save experiment_replication_cov, replace
graph combine experiment_w3_cov.gph experiment_replication_cov.gph, row(2) ysize(9.5) xsize(7.5)
graph export figureF1.pdf, replace


*Figure F3. Plotting revenge psyhology results for all other voters than pro-democratic alliance voters.
reg vengeful i.treat if votedfor > 3
margins, over(treat) post
est store vengeful

reg satisfied  i.treat if votedfor > 3
margins, over(treat) post
est store satisfaction

reg general_happy  i.treat if votedfor > 3
margins, over(treat) post
est store happy

reg pis_anger  i.treat if votedfor > 3
margins, over(treat) post
est store anger

coefplot vengeful, bylabel(Perceive Tusk as Vengeful) xlabel(1 2 3 4 5 6 7, labsize(med)) || satisfaction, bylabel(Satisfied with Restoration Strategy) || happy, bylabel(Happy with Current Political Situation) || anger, bylabel(Angry about PiS' Rule) byopts(row(4) compact note("{bf:Marginal means}", pos(1))) coeflabels(,labsize(med)) 
graph save mms_revenge_others.gph, replace

reg vengeful i.treat if votedfor > 3
margins, dydx(treat) post
est store vengeful

reg satisfied  i.treat if votedfor > 3
margins, dydx(treat) post
est store satisfaction

reg general_happy  i.treat if votedfor > 3
margins, dydx(treat) post
est store happy

reg pis_anger  i.treat if votedfor > 3
margins, dydx(treat) post
est store anger

coefplot vengeful, bylabel(Perceive Tusk as Vengeful) xlabel(-1 -.5 0 .5 1 1.5, labsize(med))  xline(0) omitted baselevels || satisfaction, bylabel(Satisfied with Restoration Strategy) omitted baselevels || happy, bylabel(Happy with Current Political Situation) omitted baselevels || anger, bylabel(Angry about PiS' Rule) omitted baselevels byopts(row(4) compact note("{bf:Effects}", pos(1))) coeflabels(0.treatment = " " 1.treatment = " " 2.treatment = " ",labsize(med)) fxsize(57) 
graph save effects_revenge_others.gph, replace

graph combine mms_revenge_others.gph effects_revenge_others.gph, row(1)
graph export figureF3.pdf, replace